package cn.kgc.client;

import cn.kgc.base.vo.UmsMemberReceiveAddressVo;
import cn.kgc.commons.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.List;

/**
 * @description:
 * @author: 石浩杰
 * @date: 2023-01-02 10:43
 */
@Component
@Slf4j
public class UmsFeignClientImpl implements UmsFeignClient {
    @Override
    public Result<List<UmsMemberReceiveAddressVo>> getUmsMemberReceiveAddress(long memberId) {
        log.error("获得用户:{},收货地址失败，服务接口降级",memberId);

        //注意 服务降级时的编码
        return Result.error(null,"http://mall-ums/umsMemberReceiveAddress/mylist",
                HttpStatus.OK.value(), "error");
    }

    @Override
    public Result<UmsMemberReceiveAddressVo> selectOne(Serializable id) {
        log.error("获得收货地址失败，服务接口降级，地址的ID为:{}",id);

        return Result.error(null,"http://mall-ums/umsMemberReceiveAddress/"+id,
                HttpStatus.OK.value(), "error");
    }
}
